﻿using Microsoft.Xna.Framework.Input;

namespace MyRoguelike.Tools
{
    static class InputManager
    {
        static private KeyboardState _newKeyboardState;
        static private KeyboardState _oldKeyboardState;

        /// <summary>
        /// Returns true if the keys was clicked
        /// </summary>
        /// <param name="keys">Key</param>
        /// <returns>True if keys was clicked</returns>
        static public bool KeyboardClick(Keys keys)
        {
            _newKeyboardState = Keyboard.GetState();

            if (_newKeyboardState.IsKeyUp(keys) && _oldKeyboardState.IsKeyDown(keys))
                return true;

            return false;
        }

        static public void Update()
        {
            _oldKeyboardState = _newKeyboardState;
        }
    }
}
